//
// Created by Administrator on 24-8-22.
//

#ifndef RTOS_THREADMGR_H
#define RTOS_THREADMGR_H

//#ifdef __cplusplus
//extern "C" {
//#endif


#include "FreeRTOS.h"
//#include "../src/freertos.c"
#include "task.h"
#include "cmsis_os.h"
#include "main.h"
#include "usart.h"


//#ifdef __cplusplus
//}
//#endif
//#define TASK_CONTROL
//#define QUEUE_TEST
//#define QUEUESAMPOR
#define BINARY_SEMAPHOR



class ThreadMGR {
public:
    ThreadMGR() ;

    ~ThreadMGR();

    void InitMutex();

    void InitSemaphores();

    void InitQueues();

    /**
     * 创建线程
     */
    void InitThreads();

    static  void StartDefaultTask(void const * argument);

     void StartTask02(void const * argument);

     void StartTask03(void const * argument);

     void StartTask04(void const * argument);

    void initThread();

private:
    // 互斥量句柄
    osMutexId myMutex01Handle;

    // 信号量句柄
    osSemaphoreId myBinarySemLEDHandle;
    osSemaphoreId myCountingSem01Handle;

    // 消息队列句柄
    osMessageQId myQueue01Handle;

    // 线程句柄
    osThreadId mytTask1Handle;
    osThreadId myTask02Handle;
    osThreadId myTask03_key0Handle;
    osThreadId myTask04_key1Handle;
};



#endif //RTOS_THREADMGR_H
